#ifndef CH_GLOBALS_H
#define CH_GLOBALS_H

#pragma once

#define XTWM_INITIAL_UPDATE  WM_USER+1024
#define SAFE_DELETE(p)  if(p) { delete p; p = NULL; }

#ifndef COLOR_GRADIENTACTIVECAPTION
#define COLOR_GRADIENTACTIVECAPTION     27
#endif
#ifndef COLOR_GRADIENTINACTIVECAPTION
#define COLOR_GRADIENTINACTIVECAPTION   28
#endif

#if _MSC_VER > 1200 //MFC 7.0
#include <..\src\mfc\afximpl.h>	// MFC Global data	
#else
#include <..\src\afximpl.h>	    // MFC Global data
#endif

#include <afxpriv.h>
#include <afxwin.h>
#include <afxcview.h>

class AFX_EXT_CLASS CHGlobal
{
public:
    CHGlobal();
    virtual ~CHGlobal();

	void LoadOSVersion();
    void LoadSysFonts();
    void FreeSysFonts();
    void LoadSysColors(); 

	COLORREF clr3DFace;
	COLORREF clr3DShadow;
	COLORREF clr3DDkShadow;
	COLORREF clr3DHilight;
	COLORREF clr3DLight;
	COLORREF clrBtnText;
	COLORREF clrGrayText;
	COLORREF clrHighlight;
	COLORREF clrHighlightText;
	COLORREF clrMenu;
	COLORREF clrMenuText;
	COLORREF clrWindow;
	COLORREF clrWindowFrame;
	COLORREF clrWindowText;
	COLORREF clrActiveCaption;
	COLORREF clrInActiveCaption;
	COLORREF clrGradActiveCapt;
	COLORREF clrGradInActiveCapt;
	COLORREF clrActiveCaptText;
	COLORREF clrInactiveCaptText;
	COLORREF clrXPBarFace;
	COLORREF clrXPHighlight;
	COLORREF clrXPHighlightBorder;
	COLORREF clrXPHighlightPushed;
	COLORREF clrXPIconShadow;
	COLORREF clrXPGrayText;
	COLORREF clrXPHighlightChecked;
	COLORREF clrXPHighlightCheckedBorder;
	COLORREF clrXPGripper;
	COLORREF clrXPSeparator;
	COLORREF clrXPDisabled;
	COLORREF clrXPMenuTextBack;
	COLORREF clrXPMenuExpanded;
	COLORREF clrXPMenuBorder;
	COLORREF clrXPMenuText;
	COLORREF clrXPHighlightText;
	COLORREF clrXPBarText;
	COLORREF clrXPBarTextPushed;
	COLORREF clrXPTabInactiveBack;
	COLORREF clrXPTabInactiveText;

	CFont font;
	CFont fontBold;
	CFont fontULine;
	CFont fontHCapt;
	CFont fontVCapt;
	CFont fontVCaptBold;
	CFont fontVCaptR;
	CFont fontVCaptRBold;

    BOOL bWin95;		// TRUE if Win 95.
    BOOL bWin98;		// TRUE if Win 98.
	BOOL bWinME;		// TRUE if Win ME.
    BOOL bWinNT;		// TRUE if Win NT.
    BOOL bWin2K;		// TRUE if Win 2000.
    BOOL bWinXP;		// TRUE if Win XP.

private:
	bool CreateSysFont(LOGFONT& lf, CFont& font, long lfWeight=FW_NORMAL, 
						char lfUnderline=0, long lfOrientation=0, long lfEscapement=0);
	bool FontExists(CString& strFaceName);
};

AFX_EXT_DATA extern CHGlobal CHGlobalData;


#endif //CH_GLOBALS_H
